<?php
require_once("../../config.php");
require_once(CONSTANT."alltype.php");
require_once(USERDIR."isuser.php");

//page_constant("reg");
//$_SESSION['username']="qqq123";
//$files=glob(PICDIR.$_SESSION['username']."/*.*");

$it = new DirectoryIterator("glob://".PICDIR.$_SESSION['username']."/*.*");
foreach($it as $f) {
	$files[]=$f->getFilename();
}
	
if(empty($files))
{
	echo "没有可以处理的文件，请联系管理员<a href='..'>返回</a>";
	exit;
}
else
	$file=$_SESSION['username']."/".$files[0];

$rs=$dsql->getone("select id from pic where userid = ".$_SESSION['userid']);
if($rs) $tpl->assign("cansame",1);
$dsql->setquery("select id,name_cn,name_en from brand");
$dsql->Execute();
while($row=$dsql->GetArray())
	$brand[]=$row;
$tpl->assign("brand",$brand);
$tpl->assign("type_category",$type_category);
$tpl->assign("picfile",$files[0]);
$tpl->assign("pic",$file);
$dsql->SetQuery("select * from alltype");
$dsql->Execute();
while($row=$dsql->GetArray())
	$alltype[]=$row;

//var_dump($alltype);
$tpl->assign("type_product",$type_product_b);
$tpl->assign("type_clothing",$type_clothing_c);
$tpl->assign("type_watch",$type_watch_c);
$tpl->assign("type_shoe",$type_shoe_c);
$tpl->assign("type_jewelry",$type_jewelry_c);
$tpl->assign("type_bag",$type_bag_c);
$tpl->assign("type_glass",$type_glass_c);
$tpl->assign("type_accessory",$type_accessory_c);


$tpl->assign("alltype",$alltype);
$tpl->display("user_dopic.tpl");
?>